package com.easygo.dao;

import com.easygo.pojo.Goods;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GoodsDao extends ElasticsearchRepository<Goods,Long> {

    // 自定义方法??? 索引库，没有SQL
    //根据标题查询 方法名字一定满足规范  带着镣铐跳舞！
    List<Goods> findGoodsByGoodsName(String goodsName);


    //根据标题查询(含分页)
    Page<Goods> findGoodsByGoodsName(String condition, Pageable pageable);


    /**
     * 多条件搜索
     * @param goodsName
     * @param caption
     * @param pageable
     * @return
     */
    Page<Goods> findGoodsByGoodsNameOrCaption(String goodsName, String caption, Pageable pageable);
}
